home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / pod.vim < prev    next >
Encoding:
Text File  |  2001-05-10  |  2.5 KB  |  82 lines

  1. " Vim syntax file
  2. " Language:    Perl POD format
  3. " Maintainer:    Scott Bigham <dsb@cs.duke.edu>
  4. " Last Change:    2001 May 09
  5.  
  6. " To add embedded POD documentation highlighting to your syntax file, add
  7. " the commands:
  8. "
  9. "   syn include @Pod <sfile>:p:h/pod.vim
  10. "   syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod
  11. "
  12. " and add myPod to the contains= list of some existing region, probably a
  13. " comment.  The "keepend" flag is needed because "=cut" is matched as a
  14. " pattern in its own right.
  15.  
  16.  
  17. " Remove any old syntax stuff hanging around (this is suppressed
  18. " automatically by ":syn include" if necessary).
  19. " For version 5.x: Clear all syntax items
  20. " For version 6.x: Quit when a syntax file was already loaded
  21. if version < 600
  22.   syntax clear
  23. elseif exists("b:current_syntax")
  24.   finish
  25. endif
  26.  
  27. " POD commands
  28. syn match podCommand    "^=head[12]"    nextgroup=podCmdText
  29. syn match podCommand    "^=item"    nextgroup=podCmdText
  30. syn match podCommand    "^=over"    nextgroup=podOverIndent skipwhite
  31. syn match podCommand    "^=back"
  32. syn match podCommand    "^=cut"
  33. syn match podCommand    "^=pod"
  34. syn match podCommand    "^=for"        nextgroup=podForKeywd skipwhite
  35. syn match podCommand    "^=begin"    nextgroup=podForKeywd skipwhite
  36. syn match podCommand    "^=end"        nextgroup=podForKeywd skipwhite
  37.  
  38. " Text of a =head1, =head2 or =item command
  39. syn match podCmdText    ".*$" contained contains=podFormat
  40.  
  41. " Indent amount of =over command
  42. syn match podOverIndent    "\d\+" contained
  43.  
  44. " Formatter identifier keyword for =for, =begin and =end commands
  45. syn match podForKeywd    "\S\+" contained
  46.  
  47. " An indented line, to be displayed verbatim
  48. syn match podVerbatimLine    "^\s.*$"
  49.  
  50. " Inline textual items handled specially by POD
  51. syn match podSpecial    "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)"
  52. syn match podSpecial    "[$@%]\I\i*\(::\I\i*\)*\>"
  53.  
  54. " Special formatting sequences
  55. syn region podFormat    start="[IBSCLFXEZ]<" end=">" oneline contains=podFormat
  56.  
  57. " Define the default highlighting.
  58. " For version 5.7 and earlier: only when not done already
  59. " For version 5.8 and later: only when an item doesn't have highlighting yet
  60. if version >= 508 || !exists("did_pod_syntax_inits")
  61.   if version < 508
  62.     let did_pod_syntax_inits = 1
  63.     command -nargs=+ HiLink hi link <args>
  64.   else
  65.     command -nargs=+ HiLink hi def link <args>
  66.   endif
  67.  
  68.   HiLink podCommand        Statement
  69.   HiLink podCmdText        String
  70.   HiLink podOverIndent        Number
  71.   HiLink podForKeywd        Identifier
  72.   HiLink podFormat        Identifier
  73.   HiLink podVerbatimLine    PreProc
  74.   HiLink podSpecial        Identifier
  75.  
  76.   delcommand HiLink
  77. endif
  78.  
  79. let b:current_syntax = "pod"
  80.  
  81. " vim: ts=8
  82.